package com.shawn.example.mvvmdemo.home.net.api

import com.jetpack.mvvm.lib.net.module.HttpApiResult
import com.shawn.example.mvvmdemo.home.model.ArticleData
import com.shawn.example.mvvmdemo.home.model.ArticleDetail
import com.shawn.example.mvvmdemo.home.model.Banner
import retrofit2.http.GET
import retrofit2.http.Path

interface HomeApiService {

    /**
     * 获取 home banner 数据
     * https://www.wanandroid.com/banner/json
     */
    @GET("banner/json")
    suspend fun getBanners(): HttpApiResult<List<Banner>>

    /**
     * 获取首页置顶文章列表
     * https://www.wanandroid.com/article/top/json
     */
    @GET("article/top/json")
    suspend fun getTopArticles(): HttpApiResult<List<ArticleDetail>>

    /**
     * 获取文章列表
     * https://www.wanandroid.com/article/list/0/json
     * @param pageNum
     */
    @GET("article/list/{pageNum}/json")
    suspend fun getArticles(@Path("pageNum") pageNum: Int): HttpApiResult<ArticleData>
}